package br.com.fidalgotecnologia.core.util;

import java.security.MessageDigest;
import sun.misc.BASE64Encoder;


public class StringEncryptUtil {

	public static synchronized String encrypt(String inputStr) {
		String retorno = null;
		try {
			MessageDigest md = MessageDigest.getInstance("SHA");
			md.update(inputStr.getBytes("UTF-8"));
			byte digest[] = md.digest();
			retorno = (new BASE64Encoder()).encode(digest);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		return retorno;
	}
}